<template>
	<div class="">
		<h2>商品订单</h2>
		<div class="iptsBox">
			<el-form :model="query" label-width="100px" inline>
				<el-form-item label="模糊搜索">
					<el-input class="width400 mr20" v-model="query.searchWord" placeholder="请输入用户昵称、ID、课程名称">
					</el-input>
				</el-form-item>
				<el-form-item label="订单状态">
					<el-select class="width400 mr20" v-model="query.status" placeholder="请选择订单状态" clearable>
						<el-option label="待支付" :value="1"></el-option>
						<el-option label="待发货" :value="2"></el-option>
						<el-option label="已发货" :value="3"></el-option>
						<el-option label="已完成" :value="4"></el-option>
						<el-option label="已退款" :value="6"></el-option>
						<el-option label="已失效" :value="7"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="订单类型">
					<el-select class="width400" v-model="query.sendType" placeholder="请选择订单类型" clearable>
						<el-option label="图书订单" :value="true"></el-option>
						<el-option label="课程订单" :value="false"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="是否修改地址">
					<el-select class="width400" v-model="query.changeAddress" placeholder="请选择" clearable>
						<el-option label="是" :value="true"></el-option>
						<el-option label="否" :value="''"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="下单日期">
					<div class="row-me">
						<el-date-picker style="width: 400px;" v-model="orderDate" type="daterange" value-format="yyyy-MM-dd"
							range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="getOrderDate">
						</el-date-picker>
						<div class="margin-left20">
							<el-button type="text" @click="getToday">今日</el-button>
							<el-button type="text" @click="yesterday">昨日</el-button>
							<el-button type="text" @click="oneMonth">本月</el-button>
							<el-button type="text" @click="lastSevenDay(30)">上月</el-button>
							<el-button type="text" @click="lastSevenDay(365)">本年</el-button>
						</div>
					</div>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" class="margin-left20" @click="handleSearch">搜索</el-button>
					<el-button type="default" @click="handleRefresh">重置</el-button>
				</el-form-item>
			</el-form>
			<div class="margin-bottom20 row-me">
				<el-button type="primary" @click="handleExport">批量导出</el-button>
				<div class="flex1"></div>
				<el-button type="text" @click="setApiParam">火风递api参数</el-button>
			</div>
		</div>
		<el-table ref="singleTable" :data="tableData" style="width: 100%" border @selection-change="handleSelectionChange">
			<el-table-column type="selection" width="55"></el-table-column>
			<el-table-column type="index" width="50" label="序号" align="center"></el-table-column>
			<el-table-column label="订单编号" align="center" width="200">
				<template slot-scope="{row}">
					<div>{{row.orderNo||''}}</div>
					<div>{{row.merchRemark||''}}</div>
				</template>
			</el-table-column>
			<el-table-column prop="name" label="用户昵称/ID" align="center" width="160">
				<template slot-scope="scope">
					<div>
						<span>{{scope.row.userName}}</span>/<span>{{scope.row.userId||''}}</span>
					</div>
				</template>
			</el-table-column>
			<el-table-column prop="promoterName" label="推荐人" align="center" width="100"></el-table-column>
			<el-table-column prop="title" label="商品信息" align="center" width="500">
				<template slot-scope="scope">
					<div class="row-me row-center">
						<img v-if="scope.row.picture" :src="scope.row.picture" alt="" class="width50 height50 margin-right10">
						<span>{{scope.row.title||''}}</span>
					</div>
				</template>
			</el-table-column>
			<el-table-column label="订单类型" align="center">
				<template slot-scope="scope">
					<div v-if="scope.row.mallProduct">
						<span v-if="scope.row.mallProduct.type==1">课程</span>
						<span v-else-if="scope.row.mallProduct.type==2">图书</span>
					</div>
				</template>
			</el-table-column>
			<el-table-column prop="payAmount" label="支付金额" align="center">
				<template slot-scope="scope">
					<el-tag type="info">{{scope.row.payAmount}}</el-tag>
				</template>
			</el-table-column>
			<el-table-column label="商品规格" align="center" prop="productItemName"></el-table-column>
			<el-table-column label="支付方式" align="center">
				<template slot-scope="scope">
					<span>{{scope.row.payType==1?'支付宝':scope.row.payType==2?'微信':scope.row.payType==3?'兑换码':''}}</span>
				</template>
			</el-table-column>
			<el-table-column label="支付状态" align="center">
				<template slot-scope="{row}">
					<span v-if="row.status==1">未支付</span>
					<span v-else-if="row.status==2">已支付</span>
					<span v-else-if="row.status==3">已发货</span>
					<span v-else-if="row.status==4">已完成</span>
					<span v-else-if="row.status==5">退款中</span>
					<span v-else-if="row.status==6">已退款</span>
					<span v-else-if="row.status==7">已失效</span>
					<span v-else-if="row.status==8">待评价</span>
					<span v-else-if="row.status==-1">已取消</span>
				</template>
			</el-table-column>
			<el-table-column prop="createTime" label="下单时间" align="center" width="160"></el-table-column>
			<el-table-column label="订单状态" align="center">
				<template slot-scope="scope">
					<span v-if="scope.row.status==1">待支付</span>
					<span v-else-if="scope.row.status==2">待发货</span>
					<span v-else-if="scope.row.status==3">已发货</span>
					<span v-else-if="scope.row.status==4">已完成</span>
					<span v-else-if="scope.row.status==7">已失效</span>
				</template>
			</el-table-column>
			<el-table-column label="操作" align="center" width="200" fixed="right">
				<template slot-scope="scope">
					<el-tag v-if="scope.row.status==2" @click.native="send(scope.row)" type="danger">点击发货</el-tag>
					<el-dropdown>
						<el-badge value="!" class="more" v-if="scope.row.changeAddress==true">
							<el-tag>更多操作</el-tag>
						</el-badge>
						<el-badge value="" class="item" v-else>
							<el-tag>更多操作</el-tag>
						</el-badge>
						<el-dropdown-menu slot="dropdown" align="center" style="color: #1890ff;">
							<el-dropdown-item @click.native="orderDetalis(scope.row.id)"><span>订单详情</span>
							</el-dropdown-item>
							<!-- 							<el-dropdown-item v-if="scope.row.addressId!=null">
								<el-badge value="!" class="item" v-if="scope.row.changeAddress==true">
									<span @click.="changeAddressConfirm(scope.row)">修改收货信息</span>
								</el-badge>
								<span v-else @click="changeAddress(scope.row)">修改收货信息</span>
							</el-dropdown-item> -->
							<el-dropdown-item v-if="scope.row.addressId&&scope.row.changeAddress"
								@click.native="changeAddressConfirm(scope.row)">
								<el-badge value="!" class="item">
									<span>修改收货信息</span>
								</el-badge>
							</el-dropdown-item>
							<el-dropdown-item @click.native="changeAddress(scope.row)"
								v-if="scope.row.addressId&&!scope.row.changeAddress"><span>修改收货信息</span>
							</el-dropdown-item>
							<el-dropdown-item @click.native="doDelete(scope.row)"><span>删除订单</span>
							</el-dropdown-item>
							<el-dropdown-item @click.native="refund(scope.row)"
								v-if="scope.row.status!=1&&scope.row.status!=6&&scope.row.status!=-1"><span>退款</span></el-dropdown-item>
							<el-dropdown-item v-if="scope.row.addressId!=null"
								@click.native="getOrderExpress(scope.row)"><span>物流详情</span></el-dropdown-item>
							<el-dropdown-item><span @click="updateRemark(scope.row)">订单备注</span></el-dropdown-item>
						</el-dropdown-menu>
					</el-dropdown>
				</template>
			</el-table-column>
		</el-table>
		<div class="pagination">
			<el-pagination background layout="->,total,sizes, prev, pager, next" :page-sizes="[10, 20, 30, 40]"
				@size-change="handleSizeChange" :current-page="query.pageNumber" :total="pageTotal"
				@current-change="handlePageChange"></el-pagination>
		</div>
		<!-- 修改收货信息申请 -->
		<el-dialog title="修改收货信息申请" :visible.sync="dialogVisibleNews" width="30%">
			<el-form ref="addressFormConfirm" :model="addressForm" label-width="80px">
				<el-form-item label="申请人"><span>{{addressForm.addressName||''}}</span></el-form-item>
				<el-form-item label="收件人"><span>{{addressForm.addressName||''}}</span></el-form-item>
				<el-form-item label="联系电话"><span>{{addressForm.addressPhoneNumber||''}}</span></el-form-item>
				<el-form-item label="邮编"><span>{{addressForm.addressPostCode||''}}</span></el-form-item>
				<el-form-item label="收货地址">
					<span>{{addressForm.addressProvince+addressForm.addressCity+addressForm.addressRegion+addressForm.addressDetailAddress}}</span>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisibleNews = false">取 消</el-button>
				<el-button type="primary" @click="doChangeAddressConfirm">同意修改</el-button>
			</span>
		</el-dialog>
		<!-- 修改收货信息 -->
		<el-dialog title="修改收货信息" :visible.sync="dialogNews" width="30%">
			<el-form ref="addressForm" :model="addressForm" label-width="80px">
				<el-form-item label="收件人">
					<el-input v-model="addressForm.addressName"></el-input>
				</el-form-item>
				<el-form-item label="联系电话">
					<el-input v-model="addressForm.addressPhoneNumber"></el-input>
				</el-form-item>
				<el-form-item label="邮编">
					<el-input v-model="addressForm.addressPostCode"></el-input>
				</el-form-item>
				<el-form-item label="省">
					<el-select placeholder="请选择省" v-model="addressForm.addressProvince" clearable filterable
						@change="[addressForm.addressCity='',addressForm.addressRegion='',getCities()]">
						<el-option v-for="(item,index) in areaData" :key="index" :label="item.name" :value="item.id+''"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="市">
					<el-select placeholder="请选择省" v-model="addressForm.addressCity" clearable filterable
						@change="[addressForm.addressRegion='',getDistricts()]">
						<el-option v-for="(item,index) in cityData" :key="index" :label="item.name" :value="item.id+''"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="区">
					<el-select placeholder="请选择省" v-model="addressForm.addressRegion" clearable filterable>
						<el-option v-for="(item,index) in districtsData" :key="index" :label="item.name"
							:value="item.id+''"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="详细地址">
					<el-input v-model="addressForm.addressDetailAddress"></el-input>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogNews = false">取 消</el-button>
				<el-button type="primary" @click="doChangeAddress">确认</el-button>
			</span>
		</el-dialog>

		<!-- 退款 -->
		<el-dialog title="退款" :visible.sync="dialogVisibleRefund" width="30%">
			<el-form ref="refundForm" :model="refundForm" label-width="80px">
				<el-form-item label="退款单号">
					<el-input v-model="refundForm.orderNo" disabled style="width: 240px;"></el-input>
				</el-form-item>
				<el-form-item label="退款金额">
					<el-input v-model="refundForm.refundAmount" style="width: 70px;"></el-input> <span
						class="margin-left10">元</span>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisibleRefund = false">取 消</el-button>
				<el-button type="primary" @click="doRefund()">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 发货 -->
		<el-dialog title="发货" :visible.sync="dialogVisibleSend" width="30%">
			<el-form ref="sendForm" :model="sendForm" :rules="sendRules" label-width="80px">
				<el-form-item label="快递公司">
					<el-select class="width400 mr20" v-model="sendForm.expressCompany" placeholder="请选择快递公司" clearable
						style="width: 240px;">
						<el-option :label="item" :value="item" v-for="item in expressCompany" :key="item"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="快递单号">
					<el-input v-model="sendForm.expressNo" style="width: 240px;"></el-input>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisibleSend = false">取 消</el-button>
				<el-button type="primary" @click="doSend()">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 物流详情 -->
		<el-dialog title="物流详情" :visible.sync="dialogVisibleExpress" width="80%">
			<el-form ref="orderExpress" :model="orderExpress" label-width="80px">
				<el-form-item label="快递公司"><span>{{orderExpress.expressCompany}}</span></el-form-item>
				<el-form-item label="快递单号"><span>{{orderExpress.expressNo}}</span></el-form-item>
			</el-form>
			<el-table ref="singleTable" :data="orderExpress.list" style="width: 100%" border>
				<el-table-column prop="time" width="200" label="时间点" align="center">
				</el-table-column>
				<el-table-column prop="status" label="事件详情" align="center">
				</el-table-column>
			</el-table>
			<span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="dialogVisibleExpress = false">关闭</el-button>
			</span>
		</el-dialog>
		<!-- 备注 -->
		<el-dialog title="修改备注" :visible.sync="dialogVisibleRemark" width="30%">
			<el-form ref="remarkForm" :model="remarkForm" label-width="80px">
				<el-form-item label="备注">
					<el-input v-model="remarkForm.remark" style="width: 240px;"></el-input>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisibleRemark = false">取 消</el-button>
				<el-button type="primary" @click="doUpdateRemark()">确 定</el-button>
			</span>
		</el-dialog>

		<!-- 设置API参数 -->
		<el-dialog title="设置API参数" :visible.sync="setApiParamVisible" width="600px" rm :model="setApiForm"
			label-width="80px">
			<el-form :model="setApiForm" label-width="80px">
				<el-form-item label="appid">
					<el-input v-model="setApiForm.appid"></el-input>
				</el-form-item>
				<el-form-item label="秘钥">
					<el-input v-model="setApiForm.key"></el-input>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisibleRemark = false">取 消</el-button>
				<el-button type="primary" @click="setApiSave()">确 定</el-button>
			</span>
		</el-dialog>

		<!-- 订单详情 -->
		<el-dialog title="订单详情" :visible.sync="detailVisible" width="60%">
			<orderDetalis :id="detailId" :key="num"></orderDetalis>
			<span slot="footer" class="">
				<el-button @click="detailVisible = false" type="primary">关 闭</el-button>
			</span>
		</el-dialog>
	</div>
</template>
<script>
	import orderDetalis from "./orderDetalis"
	export default {
		components: {
			orderDetalis
		},
		data() {
			return {
				activeName: 'first',
				dialogVisibleNews: false,
				dialogNews: false,
				dialogVisibleRefund: false,
				dialogVisibleExpress: false,
				dialogVisibleRemark: false,
				dialogVisibleSend: false,
				orderDate: [],
				addressForm: {
					id: "",
					addressName: "",
					addressPhoneNumber: "",
					addressProvince: "",
					addressCity: "",
					addressRegion: "",
					addressDetailAddress: "",
					addressPostCode: ""
				},
				form: {},
				remarkForm: {
					id: null,
					remark: ""
				},
				orderExpress: {},
				refundForm: {},
				sendForm: {
					expressCompany: "",
					expressNo: ""
				},
				expressCompany: [
					"顺丰",
					"申通",
					"圆通",
					"京东",
					"韵达",
					"中通",
					"汇通",
					"EMS",
					"天天",
					"国通",
					"德邦",
					"宅急送"
				],
				tableData: [],
				query: {
					pageNumber: 1,
					pageSize: 10,
					type: 1
				},
				pageTotal: 0,
				userAddress: {},
				sendRules: {
					expressCompany: {
						required: true,
						message: '请选择快递公司',
						trigger: 'blur'
					},
					expressNo: {
						required: true,
						message: '请输入快递单号',
						trigger: 'blur'
					}
				},
				setApiParamVisible: false,
				setApiForm: {
					appid: '',
					key: ''
				},
				detailVisible: false,
				detailId: '',
				userDetailId: '',
				multipleSelection: [],
				num: 1,
				areaData: [],
				cityData: [],
				districtsData: []

			}
		},
		mounted() {
			this.getData()
			this.getByKey()
			this.getAllArea()
		},
		methods: {
			//获取省
			async getAllArea() {
				const res = await this.$get('/admin/area/getProvince')
				if (res.code == 1000) {
					this.areaData = res.data
					this.areaData.unshift({
						adcode: '0',
						name: '默认',
						parentId: 0,
						id: '0'
					})
				}
			},
			//获取市
			async getCities() {
				const res = await this.$get('/admin/area/getCities', {
					provinceId: this.addressForm.addressProvince
				})
				if (res.code == 1000) {
					this.cityData = res.data
					this.cityData.unshift({
						adcode: '0',
						name: '默认',
						parentId: 0,
						id: '0'
					})
				}
			},
			//获取区
			async getDistricts() {
				const res = await this.$get('/admin/area/getDistricts', {
					cityId: this.addressForm.addressCity
				})
				if (res.code == 1000) {
					this.districtsData = res.data
					this.districtsData.unshift({
						adcode: '0',
						name: '默认',
						parentId: 0,
						id: '0'
					})
				}
			},
			handleExport() {
				this.query.pageNumber = 1
				this.query.pageSize = 1000000000
				let params = this.query
				params.token = localStorage.getItem('token')
				params.appid = localStorage.getItem('appid')
				window.open(this.$host + '/admin/order/exportOrder?' + this.parseParams(params));
			},
			parseParams(data) {
				try {
					var tempArr = [];
					for (var i in data) {
						var key = encodeURIComponent(i);
						var value = encodeURIComponent(data[i]);
						tempArr.push(key + '=' + value);
					}
					var urlParamsStr = tempArr.join('&');
					return urlParamsStr;
				} catch (err) {
					return '';
				}
			},
			handleSelectionChange(val) {
				this.multipleSelection = val;
			},
			async getByKey() {
				const res = await this.$get('/admin/config/getByKey', {
					key: 'config_fhd'
				})
				if (res.code == 1000) {
					this.setApiForm = res.data
					if (this.setApiForm.value && this.setApiForm.value.split('-')) {
						this.$set(this.setApiForm, 'appid', this.setApiForm.value.split('-')[0])
						this.$set(this.setApiForm, 'key', this.setApiForm.value.split('-')[1])
					}
				}
			},
			setApiParam() {
				this.setApiParamVisible = true
			},
			async setApiSave() {
				if (this.$.isEmpty(this.setApiForm.appid)) {
					this.$message.warning('请输入appid!')
					return
				}
				if (this.$.isEmpty(this.setApiForm.key)) {
					this.$message.warning('请输入秘钥!')
					return
				}
				const res = await this.$post('/admin/config/update', {
					id: this.setApiForm.id || '',
					type: 1,
					value: this.setApiForm.appid + "-" + this.setApiForm.key
				})
				if (res.code == 1000) {
					this.$message.success('设置成功')
					this.getByKey()
					this.setApiParamVisible = false
				}
			},
			// 分页导航
			handlePageChange(val) {
				this.$set(this.query, 'pageNumber', val);
				this.getData();
			},
			handleSizeChange(val) {
				this.$set(this.query, 'pageSize', val);
				this.getData();
			},
			handleClick(tab, event) {
				switch (tab.index) {
					case '0':
						this.query.status = '';
						break;
					case '1':
						this.query.status = 2;
						break;
					case '2':
						this.query.status = 3;
						break;
					case '3':
						this.query.status = 4;
						break;
					case '4':
						this.query.status = 7;
						break;
				}
				this.getData()
			},
			//今日
			getToday() {
				let date = this.$.getNowDate()
				this.orderDate = [date, date]
				this.getOrderDate();
			},
			//昨日
			yesterday() {
				let date = this.$.yesterday()
				this.orderDate = [date, date]
				this.getOrderDate();
			},
			// 最近七天
			lastSevenDay(val) {
				let endDate = this.$.getNowDate()
				let startDate = this.$.getDay(-val)
				this.orderDate = [startDate, endDate]
				this.getOrderDate();
			},
			//最近一个月
			oneMonth() {
				let endDate = this.$.getNowDate()
				let startDate = this.$.getPreMonthDay(endDate, 1)
				this.orderDate = [startDate, endDate]
				this.getOrderDate();
			},
			getOrderDate(val) {
				this.query.startDate = ''
				this.query.endDate = ''
				if (this.orderDate && this.orderDate.length != 0) {
					this.query.startDate = this.orderDate[0]
					this.query.endDate = this.orderDate[1]
				}
			},
			//搜索
			handleSearch() {
				this.$set(this.query, 'pageNumber', 1);
				this.getData();
			},
			//重置
			handleRefresh() {
				this.query = {
					pageNumber: 1,
					pageSize: 10,
					type: 1
				}
				this.orderDate = []
				this.getData();
			},
			async getData() {
				const res = await this.$get('/admin/order/pageQueryMallOrder', this.query)
				this.tableData = res.data.list
				this.pageTotal = res.data.totalRow
			},
			orderDetalis(id) {
				this.detailVisible = true
				this.detailId = id
				this.num++
			},
			refund(row) {
				this.refundForm.id = row.id;
				this.refundForm.orderNo = row.orderNo;
				this.refundForm.refundAmount = row.payAmount;
				this.dialogVisibleRefund = true
			},
			doRefund() {
				this.$refs.refundForm.validate(async valid => {
					if (valid) {
						let res = await this.$postForm('/admin/order/refundOrder', this.refundForm);
						if (res.code == 1000) {
							this.getData();
							this.dialogVisibleRefund = false
							this.$message.success('操作成功')
						}
					}
				});
			},
			send(row) {
				this.dialogVisibleSend = true
				this.sendForm.id = row.id;
				this.sendForm.expressCompany = ""
				this.sendForm.expressNo = ""
			},
			doSend() {
				this.$refs.sendForm.validate(async valid => {
					if (valid) {
						let res = await this.$postForm('/admin/order/sendOrder', this.sendForm);
						if (res.code == 1000) {
							this.getData();
							this.$message.success('操作成功')
							this.dialogVisibleSend = false;
						}
					}
				});
			},
			//审核修改申请
			changeAddressConfirm(row) {
				console.log(row, "row")
				this.dialogVisibleNews = true
				this.addressForm.id = row.id;
				this.addressForm.addressPostCode = row.addressPostCode
				this.addressForm.addressProvince = row.addressProvince
				this.addressForm.addressCity = row.addressCity
				this.addressForm.addressRegion = row.addressRegion
				this.addressForm.addressDetailAddress = row.addressDetailAddress
				this.addressForm.addressName = row.addressName
				this.addressForm.addressPhoneNumber = row.addressPhoneNumber
			},

			doChangeAddressConfirm() {
				this.$refs.addressFormConfirm.validate(async valid => {
					if (valid) {
						let res = await this.$postForm('/admin/order/confirmChangeAddress', this.addressForm);
						if (res.code == 1000) {
							this.getData();
							this.$message.success('操作成功')
							this.dialogVisibleNews = false;
						}
					}
				});
			},
			//后台发起修改地址申请
			changeAddress(row) {
				this.dialogNews = true
				this.addressForm.id = row.id;
				this.addressForm.addressPostCode = row.addressPostCode
				this.addressForm.addressProvince = row.addressProvince
				this.addressForm.addressCity = row.addressCity
				this.addressForm.addressRegion = row.addressRegion
				this.addressForm.addressDetailAddress = row.addressDetailAddress
				this.addressForm.addressName = row.addressName
				this.addressForm.addressPhoneNumber = row.addressPhoneNumber
				this.getCities()
				this.getDistricts()
			},
			doChangeAddress() {
				this.$refs.addressForm.validate(async valid => {
					if (valid) {
						let res = await this.$postForm('/admin/order/adminChangeAddress', this.addressForm);
						if (res.code == 1000) {
							this.getData();
							this.$message.success('操作成功')
							this.dialogNews = false;
						}
					}
				});
			},
			doDelete(row) {
				this.$confirm("是否删除该订单", "提示", {
						confirmButtonText: "确认", //确认按钮文字更换
						cancelButtonText: "取消", //取消按钮文字更换
						showClose: true, //是否显示右上角关闭按钮
						type: "warning", //提示类型  success/info/warning/error
					}).then(async () => {
						let res = await this.$postForm('/admin/order/deleteOrder', {
							id: row.id
						});
						if (res.code == 1000) {
							this.getData();
							this.$message.success('操作成功')
						}
						//确认操作
					}).then((data) => {
						//取消操作
					})
					.catch(function(err) {
						//捕获异常
					});

			},
			async getOrderExpress(row) {
				let res = await this.$get('/admin/order/getOrderExpress', {
					id: row.id
				});
				if (res.code == 1000) {
					this.orderExpress = res.data;
					this.dialogVisibleExpress = true;
				}
			},
			//后台发起更新备注
			updateRemark(row) {
				this.dialogVisibleRemark = true
				this.remarkForm.id = row.id;
				if (row.remark) {
					this.remarkForm.remark = row.remark
				} else {
					this.remarkForm.remark = ""
				}
			},
			async doUpdateRemark() {
				let res = await this.$postForm('/admin/order/updateRemark', this.remarkForm);
				if (res.code == 1000) {
					this.getData();
					this.remarkForm.id = "";
					this.remarkForm.remark = ""
					this.$message.success('操作成功')
					this.dialogVisibleRemark = false;
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	h2,
	h3 {
		font-weight: 600;
	}

	::v-deep .cell {
		overflow: visible !important;
		padding: 10rpx !important;
	}
</style>